<?php
$uid = $_SESSION['uid'];
$nickname_query = "SELECT `nickname` FROM `user` WHERE `uid` = :uid";
$sth_nickname   = $dbh->prepare($nickname_query);
$sth_nickname   ->bindParam(":uid",$uid);
$sth_nickname   ->execute();
$nickname       = $sth_nickname->fetch()['nickname'];
echo <<< EOT
    <!DOCTYPE HTML>
    <html>
    <head>
        <title>Afctf</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="layui/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
        <link href="/afctf/css/style.css" rel="stylesheet" type="text/css" media="all" />
        <link href="/afctf/css/reset.css" rel="stylesheet" type="text/css" media="all" />
        <link href="/afctf/css/countdown.css" rel="stylesheet" type="text/css" media="all" />
        <link href="/afctf/css/challenge.css" rel="stylesheet" type="text/css" media="all" />
        <script src="/afctf/js/jquery-3.3.1.min.js"></script> 
        <script src="/afctf/js/layer/layer.js"></script>
        <script src="/afctf/js/echarts.min.js"></script>
        <script src="/afctf/js/utils.js"></script>
        <script src="/afctf/js/challenge.js"></script>
        <script src="/afctf/js/inputLimit.js"></script>
           
    </head>
    <body>
    <div class="bh">
        <div class="header">
            <div class="logo">
                <h1><a href="index.php"><img src="/afctf/images/logo.png" alt=""></a></h1>
            </div>
            <div class='cssmenu' style="margin-left: 0;flex: 0 0 50%;max-width: 50%;display: block;width: 100%">
                <ul>
                    <li class="active" id="home"><a href='index.php'><span>首页</span></a></li>
                    <li id="announcement"><a href='index.php?action=announcement'><span>公告</span></a></li>
                    <li id="challenge"><a href='index.php?action=challenge'><span>赛题</span></a></li>
                    <li class='has-sub' id="rank"><a href='index.php?action=rank'><span>排行</span></a></li>
                    <li class='last' id="about"><a href='index.php?action=about'><span>关于</span></a></li>
                </ul>
            </div>
            <div class='cssmenu' style="margin-left: 0;flex: 0 0 20%;max-width: 20%;display: block;width: 100%">
                <ul>
                    <li id="username"><span style="margin-right:20px;max-width:120px;display:block;overflow:hidden;">$nickname</span></li>
                    <li><span>/</span></li>
                    <li id="logout"><a href="index.php?action=logout" style="">退出登录</a></li>
                </ul>
            </div>
            <div class='cssmenu' style="margin-left: 0;flex: 0 0 10%;max-width: 10%;display: block;width: 100%">
                <ul>
                    <li><a href="index.php?action=my" style="border-bottom: 0px"><img src="/afctf/images/user.png" alt=""></a></li>
                </ul>
            </div>
        </div>
    </div>
<div class="maincontainer">
EOT;
?>
